package com.engine4cloud.tdf.supervision.convert;

import com.engine4cloud.tdf.common.core.constant.enums.NormalAuditActionStatusEnum;
import com.engine4cloud.tdf.common.core.util.CodeUtils;
import com.engine4cloud.tdf.supervision.dto.create.SpReducePenaltyCreateDTO;
import com.engine4cloud.tdf.supervision.dto.result.SpReducePenaltyResultDTO;
import com.engine4cloud.tdf.supervision.dto.update.SpReducePenaltyUpdateDTO;
import com.engine4cloud.tdf.supervision.entity.SpReducePenaltyEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper
public interface SpReducePenaltyConvert {
    SpReducePenaltyConvert INSTANCE = Mappers.getMapper(SpReducePenaltyConvert.class);

    SpReducePenaltyResultDTO convert(SpReducePenaltyEntity s);

    SpReducePenaltyEntity create(SpReducePenaltyCreateDTO s);

    SpReducePenaltyEntity update(SpReducePenaltyUpdateDTO s);

    default SpReducePenaltyEntity create(SpReducePenaltyCreateDTO s, Long tenantId, NormalAuditActionStatusEnum action) {
        SpReducePenaltyEntity entity = create(s);
        entity.setTenantId(tenantId);
        entity.setLcbh(CodeUtils.entrustCode());
        entity.setPreAction(action);
        return entity;
    }
}
